<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% String path = request.getContextPath(); %>
<html>
<head>
    <title>loss</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="icon" href="<%=path%>/images/favicon.ico" sizes="32x32" />
    <link rel="stylesheet" href="<%=path%>/css/font.css">
    <link rel="stylesheet" href="<%=path%>/css/xadmin.css">
    <script type="text/javascript" src="<%=path%>/js/jquery-1.3.2.min.js"></script>
    <script src="<%=path%>/lib/layui/layui.js"></script>
    <script type="text/javascript" src="<%=path%>/js/xadmin.js"></script>
    <script src="<%=path%>/layui_exts/excel.js"></script>
    <style type="text/css">
        .layui-table{
            text-align: center;
        }
        .layui-table th{
            text-align: center;
        }
    </style>
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
       <a href="">首页</a>
        <a href="<%=path%>/MyPushObtain">查询列表</a>
      </span>
    <a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="<%=path%>/MyPushObtain" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="<%=path%>/MyPushObtain" >
            <input class="layui-input" type="hidden" name="pageIndex" value="1">
            <input class="layui-input" type="hidden" name="pageSize" value="5">
            <%--<button class="layui-btn layui-btn-sm"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>--%>
        </form>
    </div>
    <xblock>
        <span class="x-right" style="line-height:40px">共有数据：${pageList.totalCount} 条</span>
    </xblock>
    <%--表格数据--%>
    <table class="layui-table">
        <thead>
        <tr>
             <th>物品分类</th>
            <th>图片</th>
             <th>物品特征</th>
             <th>拾物时间和地点</th>
             <th>联系方式</th>
             <th>发布时间</th>
             <th>状态</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pageList.list}" var="di">
            <tr>
                  <th>${di.category}</th>
                <th style="width: 50px;"><img src="${di.image}"/></th>
                  <th><span style="text-decoration:underline" onclick="queryInfo('${di.id}')">${di.remark.length()>10?di.remark.substring(0,10):di.remark}</span></th>
                  <th>${di.address.length()>10?di.address.substring(0,10):di.address}</th>
                  <th>${di.phone}</th>
                  <th>${di.ptime}</th>
                    <th>
                        <c:if test="${di.status == '11'}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger">待审核</button>
                        </c:if>
                        <c:if test="${di.status == '00'}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger">已发布待认领</button>
                        </c:if>
                        <c:if test="${di.status == '01'}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">已认领待审核</button>
                        </c:if>
                        <c:if test="${di.status == '02'}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">审核已同意</button>
                        </c:if>
                        <c:if test="${di.status == '03'}">
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">审核已拒绝</button>
                        </c:if>
                    </th>

            </tr>
        </c:forEach>
        </tbody>
    </table>

    <div class="" >
        <input type="hidden" id="totalPageCount" value="${pageList.pageTotalCount}"/>
        <c:import url="pageBtn.jsp">
            <c:param name="totalCount" value="${pageList.totalCount}"/>
            <c:param name="currentPageNo" value="${pageList.pageIndex}"/>
            <c:param name="totalPageCount" value="${pageList.pageTotalCount}"/>
        </c:import>
    </div>

    <%--查看--%>
    <div class="layui-row" id="test3" style="display: none;">
        <div class="layui-col-md10">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">物品分类：</label>
                    <div class="layui-input-block">
                        <input type="text"  name="category" id="q_category" disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">物品特征：</label>
                    <div class="layui-input-block">
                        <textarea name="remark" disabled id="q_remark" placeholder=""  class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">拾物时间和地点：</label>
                    <div class="layui-input-block">
                        <input type="text" name="address" id="q_address" disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" id="q_phone"  disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发布人：</label>
                    <div class="layui-input-block">
                        <input type="text" name="pname" id="q_pname"  disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发布时间：</label>
                    <div class="layui-input-block">
                        <input type="text" name="ptime" id="q_ptime"  disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">认领人：</label>
                    <div class="layui-input-block">
                        <input type="text" name="uname" id="q_uname"  disabled class="layui-input" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">核验信息：</label>
                    <div class="layui-input-block">
                        <textarea name="content" disabled="" id="q_content" placeholder="请输入核验信息"  class="layui-textarea"></textarea>
                    </div>
                </div>
            </form>
        </div>
    </div>


    <script>
        layui.config({
            base: 'layui_exts/',
        }).extend({
            excel: 'excel',
        });

        layui.use(['jquery', 'excel','form','layer','laydate'], function(){
            var form = layui.form,
                $ = layui.jquery,
                laydate = layui.laydate;
            var excel = parent.layui.excel;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

        });

        /*查看*/
        function queryInfo(id){
            layui.use(['jquery', 'excel','form','layer','laydate'], function(){
                var form = layui.form,$ = layui.jquery;
                $.ajax({
                    url: '<%=path%>/queryObtainInfo?id='+id,
                    type: "post",
                    contentType: "application/json; charset=utf-8",
                    dataType : "json",
                    success:function(data){
                        debugger
                        layer.open({
                            type:1,
                            title:"查看信息",
                            skin:"myclass",
                            area:["50%"],
                            anim:2,
                            content:$("#test3"),
                            success: function() {
                                $("#q_category").val(data.category);
                                $("#q_remark").val(data.remark);
                                $("#q_address").val(data.address);
                                $("#q_phone").val(data.phone);
                                $("#q_pname").val(data.pname);
                                $("#q_ptime").val(data.ptime);
                                $("#q_uname").val(data.uname);
                                $("#q_content").val(data.content);
                            }
                        });
                    },
                    error:function(){
                        layer.msg('获取失败',{icon:0,time:3000});
                        setTimeout(function () {window.location.href='<%=path%>/findObtain';},2000);
                    }
                });
            });
        }


    </script>
</body>
</html>
